﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Kctz.aspx.cs" Inherits="Catering.Catering_Page.Kufang.Kctz" %>

<!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/Dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <title>菜品管理</title>
    <link rel="stylesheet" type="text/css" href="../../../Style/head.css" />
    <link rel="stylesheet" type="text/css" href="../../Style/center.css" />
    <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="../../Scripts/tinybox.js" type="text/javascript"></script>
    <script src="../../../Style/xxk.js" type="text/javascript"></script>
    <script src="../../Scripts/zhezhao.js" type="text/javascript"></script>
    <link href="../../Style/jquery.treeview.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .Create_Recipe{border: 1px solid #159aec;border-top: none;width: 998px;margin-top: 0;}
        .soso_lt{padding: 5px 0;}
        .soso_lt a{margin-left: 3px;}
        
        a.add_new1{position: absolute;top: 8px;right: 10px;background: url(../../Images/jiahao.gif) left center no-repeat;padding-left: 15px;}
        a.add_new1:link, a.add_new:visited{color: #de10ab;}
        a.add_new1:hover{color: #000;}
        
        a.add_innsert1{position: absolute;top: 8px;right: 60px;background: url(../../Images/jiahao.gif) left center no-repeat;padding-left: 15px;}
        a.add_innsert1:link, a.add_innsert:visited
        {
            color: #de10ab;
        }
        a.add_innsert1:hover
        {
            color: #000;
        }
        #Dish_List{padding:5px 0px 0px 10px; height:430px; overflow-y:scroll;}
        #Dish_List a
        {
            cursor: pointer;
        }
        #Dish_List a:hover
        {
            background-color: #FFFFFF;
        }
        .display_none{display:none;}
        .def_li_a{background:url('../../../Images/def_li_a.jpg') no-repeat left;padding-left:15px;}
        .over_li_a{ background-image:url('../../../Images/over_li_a.jpg');}
    </style>
    <!-----搜索原料------>

    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            $("#but_Raw_seach").click(function () {
                $("#Dish_List a").css("color", "#000");
                var serach_txt = $("#Txt_seach_Raw").val();
                $("#Dish_List a[IsCai='true']:contains('" + serach_txt + "')").css("color", "red").parents("#Dish_List ul").prev("a").css("color", "red");
            });

            $("#Dish_List a[IsCai='false']").addClass("def_li_a");
            $("#Dish_List a[IsCai='false']").next().addClass("display_none");

            $("#Dish_List a[IsCai='false']").click(function () {
                $(this).next().toggleClass("display_none");
                $(this).toggleClass("over_li_a");
            });

            $("#Dish_List a[IsCai='true']").bind("click", cai_click);
        });

        function cai_click() {
            $("#Dish_List a[IsCai='true']").css("background-color", "#fff");
            $("#HidID").val($(this).attr("uid"));
            $("#HidName").val($(this).text());
            $(this).css("background-color", "#FCA402");

            document.getElementById("iframe_info").contentWindow.Search($(this).attr("uid"), $(this).text());
            //$("#iframe_info").attr("src", "YuanliaoInfo.aspx?cid=" + $(this).attr("uid"));
        }

        function SetUrl() {
            $("#iframe_info").attr("src", "YuanliaoInfo.aspx");
        }

        function DelRaw() {
            return confirm("确定删除:" + $("#HidName").val());
        }

        //动态修改原料名称
        function SetRAWName(id, Name) {
            $("#Dish_List a[IsCai='true'][uid='" + id + "']").text(Name);
        }

        //动态添加原料名称
        function AddRAWName(IsTypeInfo, TypeId, RawID, RawName) {
            debugger;
            var a = $("<li><a iscai=\"true\" uid=\"" + RawID + "\">" + RawName + "</a></li>");
            a.find("a").bind("click", cai_click);
            $("#Dish_List a[IsTypeInfo='" + IsTypeInfo + "'][TypeID='" + TypeId + "']").next().append(a);
        }

    </script>
    <script language="javascript" type="text/javascript">
        function ClearPageInput_Dish() {
            $("#ButClear_Dish").click();
        }

        //设置Enter快捷键
        function IsSearch(e) {

        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <!---控件隐藏区--->
    <asp:HiddenField ID="HidID" runat="server" />
    <asp:HiddenField ID="HidName" runat="server" />
    <div class="Center_Content" id="div2_2" style="display: block;">
        <div class="Create_Recipe">
            <div class="left_CR" style="padding-top:10px;">
                <div class="Recipe_ylsz">
                    <h1>我的原料列表</h1>
                    <div id="Div_RawMaterial" class="Dl_div" style="height: 463px;">
                        <ul id="Dish_List">
                            <%if (dt_RawMaterials != null && dt_RawMaterials.Rows.Count > 0)
                              {
                                  foreach (System.Data.DataRow row in dt_RawMaterials.Rows)
                                  { 
                                    %>
                                        <li>
                                            <a iscai="false" IsType="true" IsTypeInfo="false" TypeID="<%=row["id"].ToString()%>"><%=row["TypeName"].ToString()%></a>
                                            <ul class="treeview">
                                                <%
                                                    if (this.dt_RawMaterialsInfo.Select("RMID=" + row["id"].ToString()).Count() == 1 && this.dt_RawMaterialsInfo.Select("RMID=" + row["id"].ToString())[0]["Name"].ToString() == row["TypeName"].ToString())
                                                    {
                                                        string rawids = this.dt_RawMaterialsInfo.Select("RMID=" + row["id"].ToString())[0]["id"].ToString();
                                                        this.dt_RawMaterial = new Catering_Rules.T_RawMaterial().GetList("RAWIDS=" + rawids, "id,RAWName").Tables[0];
                                                        foreach (System.Data.DataRow item in dt_RawMaterial.Rows)
                                                        { 
                                                            %>
                                                                <li><a iscai="true" uid="<%=item["id"].ToString()%>"><%=item["RAWName"].ToString()%></a></li>
                                                            <%
                                                        }
                                                    }
                                                    else
                                                    {
                                                        foreach (System.Data.DataRow rowinfo in dt_RawMaterialsInfo.Select("RMID=" + row["id"].ToString()))
                                                        { 
                                                            %>
                                                                <li> 
                                                                <a iscai="false" IsType="true" IsTypeInfo="true" TypeID="<%=rowinfo["id"].ToString()%>"><%=rowinfo["Name"].ToString()%></a>
                                                                <ul class="treeview">
                                                                    <%
                                                            this.dt_RawMaterial = new Catering_Rules.T_RawMaterial().GetList("RAWIDS=" + rowinfo["id"].ToString(), "id,RAWName").Tables[0];
                                                                        foreach (System.Data.DataRow item in dt_RawMaterial.Rows)
                                                                        { 
                                                                            %>
                                                                                <li><a iscai="true" uid="<%=item["id"].ToString()%>"><%=item["RAWName"].ToString()%></a></li>
                                                                            <%
                                                                        }
                                                                     %>
                                                                </ul>
                                                                </li>
                                                            <%
                                                        }
                                                    }
                                                 %>
                                            </ul>
                                        </li>
                                    <%
                                  }
                              } %>
                        </ul>
                        <div class="soso_lt_div" style="height:30px;">
                            <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                <tr>
                                    <td valign="middle" width="144" align="center" height="36">
                                        <input type="text" id="Txt_seach_Raw" onkeydown="IsSearch()" style="width:120px; height:20px; line-height:20px;" type="text" class="input_bg" />
                                    </td>
                                    <td valign="middle" align="left">
                                        <input type="button" class="button_soso_lt" style="margin:0px;" id="but_Raw_seach" />
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            <div class="Right_CR" style="width:800px;height:500px;">
                <iframe id="iframe_info" frameborder="0" scrolling="no" height="100%" width="100%" src="Kctz_info.aspx"></iframe>
            </div>
            
        </div>
    </div>
    <div class="footer"> 
        <strong>中海油能源发展配餐服务公司渤海自营油田作业公司&nbsp;&nbsp;版权所有@CopyRight 2012</strong><span>技术支持：北京天择嘉业科技有限公司</span>
    </div>
    </form>
</body>
</html>
